<?php
	$group_name 		= $this->formText ('group_name', $this->Item['group_name'], array ('class' => 'txtlong' ) ) . '<div class="view_error" id="view_group_name"></div>';
	$option 			= array('Không','Có');
	$group_acp 			= 1;
	if(isset($this->Item['group_acp'])){
		$group_acp 		= $this->Item['group_acp'];
	}
	$group_acp 			= $this->formRadio('group_acp',$group_acp,null,$option, ' ');
	$group_default 		= 1;
	if(isset($this->Item['group_default'])){
		$group_default 	= $this->Item['group_default'];
	}
	$group_default 		= $this->formRadio('group_default',$group_default,null,$option, ' ');
	$status 			= 1;
	if(isset($this->Item['status'])){
		$status 		= $this->Item['status'];
	}
	$status 			= $this->formRadio('status',$status,null,$option, ' ');
	$order 				= 255;
	if(isset($this->Item['order'])){
		$order 			= $this->Item['order'];
	}
	$order 				= $this->formText ('order', $order, array ('class' => 'txtshort' ) );
	$content 			= $this->cmsEditor('content',htmlspecialchars_decode($this->Item['content']),array('toolbar'=>'MyToolbar', 'language'=>'vi', 'skin' => 'v2'), 'auto', 200, true, 500, false);
?>

<div class="left_content">
	<?php echo $this->render($this->arrParam['controller'] . '/toolbar/left.php');?>
</div>

<div class="right_content">
	<div class="appContent">
		<form action="" method="post" name="appForm" enctype="multipart/form-data">
			<?php echo $this->render($this->arrParam['controller'] . '/toolbar/index.php');?>
			<?php
				//-------------------- SESSAGES ERROR ------------------
				if(count($this->messageError)>0){
					foreach ($this->messageError AS $key => $val){
						echo '<div class="listError" data="'.$key.'" rel="' . $val . '"></div>';
					}
					echo '<div class="thongbaoError goc5">Có lỗi trong quá trình xử lý.</div>';
				} 
			?>
			<div id="tabs">
				<ul>
					<li><a href="#tabs-1">Thông tin chung</a></li>
					<li><a href="#tabs-2">Phân quyền</a></li>
				</ul>
				<div id="tabs-1">
					<div class="tblForm">
						<div class="tbl_content">
							<table class="tbl">
								<tr>
									<td class="label">Tên nhóm <span class="red">*</span></td>
									<td><?php echo $group_name;?></td>
								</tr>
								<tr>
									<td class="label">Thứ tự</td>
									<td><?php echo $order;?></td>
								</tr>
								<tr>
									<td class="label">Hiển thị</td>
									<td><?php echo $status;?></td>
								</tr>
								<tr>
									<td class="label">Cho phép vào admin</td>
									<td><?php echo $group_acp;?></td>
								</tr>
								<tr>
									<td class="label">Nhóm mặc định</td>
									<td><?php echo $group_default;?></td>
								</tr>
								<tr>
									<td class="label">Nội dung</td>
									<td><?php echo $content;?></td>
								</tr>
							</table>
						</div>
					</div>
				</div>
				<div id="tabs-2">
					<div class="tblForm">
						<div class="tbl_content">
							<div class="privileges">
								<label class="div_title start"><input type="checkbox" name="fullAccess"> Toàn quyền hệ thống</label>
								<div class="clr"></div>						
								<?php
								foreach ($this->PrivilegesModule as $key_module => $val_module){
									foreach ($this->Privileges as $key => $val){
										if($val['module'] == $val_module){
											$listOption[$key_module][$val['id']] = $val['name'];
										}
									}
									$arrOption = $this->formMultiCheckbox('privileges',$this->Item['privileges'],array(),$listOption[$key_module],'');
									echo '<label class="div_title"><input type="checkbox" name="'.$val_module.'" id="module_'.$val_module.'" onclick="checkPermision(\'module_'.$val_module.'\')">'.$this->language['module_' . $val_module].'</label>';
									echo '<div class="divformlist" id="module_'.$val_module.'">' . $arrOption . '<div class="clr"></div></div>';
								} 
								?>
								<label class="div_title"><input type="checkbox" name="module_file" id="module_file" onclick="checkPermision('module_file')"> Quản lý file upload</label>
								<div class="divformlist" id="module_file">
									<label><?php echo $this->formCheckbox('disabled',$this->Item['disabled'],array(),array(1)).'Truy cập upload';?></label><label><?php echo $this->formCheckbox('denyZipDownload',$this->Item['denyZipDownload'],array(),array(1)).'Upload file zip';?></label><label><?php echo $this->formCheckbox('denyExtensionRename',$this->Item['denyExtensionRename'],array(),array(1)).'Đổi tên phần mở rộng';?></label><label><?php echo $this->formCheckbox('files_upload',$this->Item['files_upload'],array(),array(1)).'Upload file';?></label><label><?php echo $this->formCheckbox('files_delete',$this->Item['files_delete'],array(),array(1)).'Xóa file';?></label><label><?php echo $this->formCheckbox('files_copy',$this->Item['files_copy'],array(),array(1)).'Coppy file';?></label><label><?php echo $this->formCheckbox('files_move',$this->Item['files_move'],array(),array(1)).'Di chuyển file';?></label><label><?php echo $this->formCheckbox('files_rename',$this->Item['files_rename'],array(),array(1)).'Đổi tên file';?></label><label><?php echo $this->formCheckbox('dirs_create',$this->Item['dirs_create'],array(),array(1)).'Tạo thư mục mới';?></label><label><?php echo $this->formCheckbox('dirs_delete',$this->Item['dirs_delete'],array(),array(1)).'Xóa thư mục';?></label><label><?php echo $this->formCheckbox('dirs_rename',$this->Item['dirs_rename'],array(),array(1)).'Đổi tên thư mục';?></label><div class="clr"></div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</form>
	</div>
</div>
<div class="clr"></div>	

<script type="text/javascript">
	function checkPermision(item){
		if ($('input[type=checkbox]#' + item).is(':checked')) {
		    $('input[type=checkbox]', 'div#' + item).prop('checked', true);
		} else {
			$('input[type=checkbox]', 'div#' + item).prop('checked', false);
		}
	}
</script>


